﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My.Resources;
    using C1.Win.C1FlexGrid;
    using C1.Win.C1FlexGrid.Util.BaseControls;
    using Microsoft.VisualBasic;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_TruyVanCongNoPhaiThu : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("AdvKhachHang")]
        private ADVObjects _AdvKhachHang;
        [AccessedThroughProperty("AdvTaiKhoanChu")]
        private ADVAccount _AdvTaiKhoanChu;
        [AccessedThroughProperty("CmdXem")]
        private Button _CmdXem;
        [AccessedThroughProperty("Label1")]
        private Label _Label1;
        [AccessedThroughProperty("Label13")]
        private Label _Label13;
        [AccessedThroughProperty("Label16")]
        private Label _Label16;
        [AccessedThroughProperty("Label2")]
        private Label _Label2;
        [AccessedThroughProperty("Panel1")]
        private Panel _Panel1;
        [AccessedThroughProperty("Panel2")]
        private Panel _Panel2;
        [AccessedThroughProperty("TxtDenNgay")]
        private DateTimePicker _TxtDenNgay;
        [AccessedThroughProperty("TxtTuNgay")]
        private DateTimePicker _TxtTuNgay;
        [AccessedThroughProperty("VSlist")]
        private C1.Win.C1FlexGrid.C1FlexGrid _VSlist;
        public string cFrmKhoaDoiTuong;
        public string cFrmKhoaTaiKhoan;
        public string cFrmNamThang;
        private IContainer components;

        public Frm_TruyVanCongNoPhaiThu()
        {
            base.Load += new EventHandler(this.Frm_TruyVanCongNoPhaiThu_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.cFrmKhoaDoiTuong = "";
            this.cFrmNamThang = "";
            this.cFrmKhoaTaiKhoan = "";
            this.InitializeComponent();
        }

        private void CmdXem_Click(object sender, EventArgs e)
        {
            this.LoadData();
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void Frm_TruyVanCongNoPhaiThu_Load(object sender, EventArgs e)
        {
            if (LVYModule.ReturnIfNull(this.cFrmKhoaDoiTuong, "", modGeneral.TypeOfValue.Nothing).ToString().Trim() != "")
            {
                this.AdvKhachHang.Value = this.cFrmKhoaDoiTuong;
            }
            if (LVYModule.ReturnIfNull(this.cFrmNamThang, "", modGeneral.TypeOfValue.Nothing).ToString().Trim() != "")
            {
                this.TxtTuNgay.Text = "01/" + LVYModule.sRight(this.cFrmNamThang, 2) + "/" + LVYModule.sLeft(this.cFrmNamThang, 4);
                this.TxtDenNgay.Text = Strings.Format(DateAndTime.Today, "dd/MM/yyyy");
                if (LVYModule.sRight(this.TxtTuNgay.Text, 7) != LVYModule.sRight(this.TxtDenNgay.Text, 7))
                {
                    this.TxtDenNgay.Text = DateTime.DaysInMonth(Conversions.ToInteger(LVYModule.sRight(this.TxtTuNgay.Text, 4)), Conversions.ToInteger(LVYModule.sMid(this.TxtTuNgay.Text, 4, 2))).ToString() + "/" + LVYModule.sRight(this.TxtTuNgay.Text, 7);
                }
            }
            else
            {
                this.TxtTuNgay.Text = "01/" + LVYModule.sRight("00" + Conversions.ToString(DateAndTime.Month(DateAndTime.Today)), 2) + "/" + Conversions.ToString(DateAndTime.Year(DateAndTime.Today));
                this.TxtDenNgay.Text = Strings.Format(DateAndTime.Today, "dd/MM/yyyy");
            }
            if (LVYModule.ReturnIfNull(this.cFrmKhoaTaiKhoan, "", modGeneral.TypeOfValue.Nothing).ToString().Trim() != "")
            {
                this.AdvTaiKhoanChu.Value = this.cFrmKhoaTaiKhoan;
            }
            else
            {
                this.AdvTaiKhoanChu.SetDefault();
            }
            if ((this.AdvKhachHang.Value.Trim() != "") & (this.AdvTaiKhoanChu.Value.Trim() != ""))
            {
                this.LoadData();
            }
        }

        public DataTable GetData()
        {
            DataTable table;
            IDataParameter[] commandParameters = new IDataParameter[6];
            try
            {
                commandParameters[0] = DBHelper.createParameter("@KhoaDonVi", DbType.Int64, ParameterDirection.Input, modGeneral.H_CLIENT);
                commandParameters[1] = DBHelper.createParameter("@TuNgay", DbType.Int64, ParameterDirection.Input, LVYModule.Date2Char(this.TxtTuNgay.Text));
                commandParameters[2] = DBHelper.createParameter("@DenNgay", DbType.Int64, ParameterDirection.Input, LVYModule.Date2Char(this.TxtDenNgay.Text));
                commandParameters[3] = DBHelper.createParameter("@KhoaTaiKhoan", DbType.Int64, ParameterDirection.Input, this.AdvTaiKhoanChu.Value);
                commandParameters[4] = DBHelper.createParameter("@KhoaDoiTuong", DbType.Int64, ParameterDirection.Input, this.AdvKhachHang.Value);
                commandParameters[5] = DBHelper.createParameter("@Language", DbType.Int64, ParameterDirection.Input, modGeneral.H_LANGUAGE);
                table = DBHelper.ExecuteDataset(modGeneral.ConnectionString, CommandType.StoredProcedure, "BH_BC_DoiChieuCongNoTongHop", commandParameters).Tables[0];
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                MessageBox.Show(exception.Message);
                table = null;
                ProjectData.ClearProjectError();
                return table;
                ProjectData.ClearProjectError();
            }
            return table;
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_TruyVanCongNoPhaiThu));
            this.Panel2 = new Panel();
            this.VSlist = new C1.Win.C1FlexGrid.C1FlexGrid();
            this.Panel1 = new Panel();
            this.CmdXem = new Button();
            this.Label2 = new Label();
            this.AdvTaiKhoanChu = new ADVAccount();
            this.Label16 = new Label();
            this.AdvKhachHang = new ADVObjects();
            this.Label1 = new Label();
            this.TxtDenNgay = new DateTimePicker();
            this.Label13 = new Label();
            this.TxtTuNgay = new DateTimePicker();
            this.VSlist.BeginInit();
            this.Panel1.SuspendLayout();
            this.SuspendLayout();
            this.Panel2.Dock = DockStyle.Bottom;
            Point point = new Point(0, 0x21b);
            this.Panel2.Location = point;
            this.Panel2.Name = "Panel2";
            Size size = new Size(0x31a, 0x1d);
            this.Panel2.Size = size;
            this.Panel2.TabIndex = 1;
            this.VSlist.AllowEditing = false;
            this.VSlist.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.Light3D;
            this.VSlist.ColumnInfo = manager.GetString("VSlist.ColumnInfo");
            this.VSlist.Dock = DockStyle.Fill;
            this.VSlist.ExtendLastCol = true;
            this.VSlist.FocusRect = FocusRectEnum.None;
            this.VSlist.KeyActionEnter = KeyActionEnum.MoveAcross;
            point = new Point(0, 0x34);
            this.VSlist.Location = point;
            this.VSlist.Name = "VSlist";
            this.VSlist.Rows.Count = 1;
            this.VSlist.Rows.DefaultSize = 0x11;
            this.VSlist.SelectionMode = SelectionModeEnum.Row;
            size = new Size(0x31a, 0x1e7);
            this.VSlist.Size = size;
            this.VSlist.StyleInfo = manager.GetString("VSlist.StyleInfo");
            this.VSlist.TabIndex = 0x20;
            this.VSlist.VisualStyle = VisualStyle.Office2007Blue;
            this.Panel1.BackgroundImage = ACCOUNTING.My.Resources.Resources.bgleft;
            this.Panel1.Controls.Add(this.CmdXem);
            this.Panel1.Controls.Add(this.Label2);
            this.Panel1.Controls.Add(this.AdvTaiKhoanChu);
            this.Panel1.Controls.Add(this.Label16);
            this.Panel1.Controls.Add(this.AdvKhachHang);
            this.Panel1.Controls.Add(this.Label1);
            this.Panel1.Controls.Add(this.TxtDenNgay);
            this.Panel1.Controls.Add(this.Label13);
            this.Panel1.Controls.Add(this.TxtTuNgay);
            this.Panel1.Dock = DockStyle.Top;
            point = new Point(0, 0);
            this.Panel1.Location = point;
            this.Panel1.Name = "Panel1";
            size = new Size(0x31a, 0x34);
            this.Panel1.Size = size;
            this.Panel1.TabIndex = 0;
            this.CmdXem.Image = ACCOUNTING.My.Resources.Resources.Selected;
            this.CmdXem.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0x2d3, 20);
            this.CmdXem.Location = point;
            this.CmdXem.Name = "CmdXem";
            size = new Size(70, 0x18);
            this.CmdXem.Size = size;
            this.CmdXem.TabIndex = 0x81;
            this.CmdXem.Text = "&Xem";
            this.CmdXem.UseVisualStyleBackColor = true;
            this.Label2.AutoSize = true;
            this.Label2.BackColor = Color.Transparent;
            this.Label2.ForeColor = Color.Black;
            point = new Point(0x1ce, 6);
            this.Label2.Location = point;
            this.Label2.Name = "Label2";
            size = new Size(0x37, 13);
            this.Label2.Size = size;
            this.Label2.TabIndex = 0x80;
            this.Label2.Text = "T\x00e0i khoản";
            this.AdvTaiKhoanChu.Conditions = "";
            this.AdvTaiKhoanChu.DefaultValue = "131";
            this.AdvTaiKhoanChu.FieldNameFilter = "Left(SoTaiKhoan,3)";
            this.AdvTaiKhoanChu.KeyFilter = "131";
            point = new Point(0x1d1, 0x17);
            this.AdvTaiKhoanChu.Location = point;
            Padding padding = new Padding(0);
            this.AdvTaiKhoanChu.Margin = padding;
            this.AdvTaiKhoanChu.Name = "AdvTaiKhoanChu";
            this.AdvTaiKhoanChu.OnlyDigit = false;
            this.AdvTaiKhoanChu.ReadOnly = false;
            size = new Size(0x101, 20);
            this.AdvTaiKhoanChu.Size = size;
            this.AdvTaiKhoanChu.TabIndex = 0x7f;
            this.AdvTaiKhoanChu.UpperText = true;
            this.AdvTaiKhoanChu.Value = "";
            this.AdvTaiKhoanChu.WithCode = 80;
            this.Label16.AutoEllipsis = true;
            this.Label16.AutoSize = true;
            this.Label16.BackColor = Color.Transparent;
            this.Label16.ForeColor = Color.Black;
            point = new Point(0xbb, 6);
            this.Label16.Location = point;
            this.Label16.Name = "Label16";
            this.Label16.RightToLeft = RightToLeft.No;
            size = new Size(0x41, 13);
            this.Label16.Size = size;
            this.Label16.TabIndex = 0x38;
            this.Label16.Text = "Kh\x00e1ch h\x00e0ng";
            this.Label16.TextAlign = ContentAlignment.TopRight;
            this.AdvKhachHang.Conditions = "";
            this.AdvKhachHang.LoaiDoiTuong = modGeneral.TypeObjects.KhachHang;
            point = new Point(190, 0x17);
            this.AdvKhachHang.Location = point;
            this.AdvKhachHang.Name = "AdvKhachHang";
            this.AdvKhachHang.ReadOnly = false;
            size = new Size(0x10d, 20);
            this.AdvKhachHang.Size = size;
            this.AdvKhachHang.TabIndex = 0x39;
            this.AdvKhachHang.UpperText = true;
            this.AdvKhachHang.Value = "";
            this.AdvKhachHang.WidthCode = 80;
            this.Label1.AutoSize = true;
            this.Label1.BackColor = Color.Transparent;
            this.Label1.ForeColor = Color.Black;
            point = new Point(0x5f, 6);
            this.Label1.Location = point;
            this.Label1.Name = "Label1";
            size = new Size(0x35, 13);
            this.Label1.Size = size;
            this.Label1.TabIndex = 0x37;
            this.Label1.Text = "Đến ng\x00e0y";
            this.TxtDenNgay.Format = DateTimePickerFormat.Short;
            point = new Point(0x62, 0x17);
            this.TxtDenNgay.Location = point;
            this.TxtDenNgay.Name = "TxtDenNgay";
            size = new Size(0x57, 20);
            this.TxtDenNgay.Size = size;
            this.TxtDenNgay.TabIndex = 0x36;
            this.Label13.AutoSize = true;
            this.Label13.BackColor = Color.Transparent;
            this.Label13.ForeColor = Color.Black;
            point = new Point(2, 6);
            this.Label13.Location = point;
            this.Label13.Name = "Label13";
            size = new Size(0x2e, 13);
            this.Label13.Size = size;
            this.Label13.TabIndex = 0x35;
            this.Label13.Text = "Từ ng\x00e0y";
            this.TxtTuNgay.Format = DateTimePickerFormat.Short;
            point = new Point(6, 0x17);
            this.TxtTuNgay.Location = point;
            this.TxtTuNgay.Name = "TxtTuNgay";
            size = new Size(0x57, 20);
            this.TxtTuNgay.Size = size;
            this.TxtTuNgay.TabIndex = 0x34;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            size = new Size(0x31a, 0x238);
            this.ClientSize = size;
            this.Controls.Add(this.VSlist);
            this.Controls.Add(this.Panel2);
            this.Controls.Add(this.Panel1);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.KeyPreview = true;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "Frm_TruyVanCongNoPhaiThu";
            this.ShowIcon = false;
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "TRA CUU CONG NO PHAI THU";
            this.VSlist.EndInit();
            this.Panel1.ResumeLayout(false);
            this.Panel1.PerformLayout();
            this.ResumeLayout(false);
        }

        public void LoadData()
        {
            int num = 0;
            double num3 = 0.0;
            double num2 = 0.0;
            double num5 = 0.0;
            double num4 = 0.0;
            this.VSlist.Select(0, 1);
            this.VSlist.Rows.Count = 1;
            DataTable data = this.GetData();
            if ((data != null) && (data.Rows.Count != 0))
            {
                num3 = Conversions.ToDouble(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(data.Rows[0]["SoDuNoDauKy"]), 0, modGeneral.TypeOfValue.Nothing));
                num2 = Conversions.ToDouble(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(data.Rows[0]["SoDuCoDauKy"]), 0, modGeneral.TypeOfValue.Nothing));
                num5 = Conversions.ToDouble(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(data.Rows[0]["TongSoPhatSinhNo"]), 0, modGeneral.TypeOfValue.Nothing));
                num4 = Conversions.ToDouble(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(data.Rows[0]["TongSoPhatSinhCo"]), 0, modGeneral.TypeOfValue.Nothing));
                C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
                vSlist.AddItem("");
                vSlist[vSlist.Rows.Count - 1, 4] = modGeneral.Tranlated("Số dư đầu kỳ:", "");
                vSlist[vSlist.Rows.Count - 1, 5] = RuntimeHelpers.GetObjectValue(data.Rows[0]["SoDuNoDauKy"]);
                vSlist[vSlist.Rows.Count - 1, 6] = RuntimeHelpers.GetObjectValue(data.Rows[0]["SoDuCoDauKy"]);
                CellStyle style = vSlist.Styles["Red"];
                if (style == null)
                {
                    style = vSlist.Styles.Add("Red");
                    style.BackColor = Color.DarkSeaGreen;
                    style.Border.Style = C1.Win.C1FlexGrid.BorderStyleEnum.None;
                    style.Font = new Font(this.Font, FontStyle.Bold);
                }
                //vSlist.GetCellRange(vSlist.Rows.Count - 1, 0, vSlist.Rows.Count - 1, vSlist.Cols.Count - 1).Style = style;
                int num6 = data.Rows.Count - 1;
                for (num = 0; num <= num6; num++)
                {
                    vSlist.AddItem("");
                    vSlist[vSlist.Rows.Count - 1, 1] = RuntimeHelpers.GetObjectValue(data.Rows[num]["Ngay"]);
                    vSlist[vSlist.Rows.Count - 1, 2] = RuntimeHelpers.GetObjectValue(data.Rows[num]["SoChungTu"]);
                    vSlist[vSlist.Rows.Count - 1, 3] = RuntimeHelpers.GetObjectValue(data.Rows[num]["SoHoaDon"]);
                    vSlist[vSlist.Rows.Count - 1, 4] = RuntimeHelpers.GetObjectValue(data.Rows[num]["DienGiai"]);
                    vSlist[vSlist.Rows.Count - 1, 5] = RuntimeHelpers.GetObjectValue(data.Rows[num]["SoPhatSinhNo"]);
                    vSlist[vSlist.Rows.Count - 1, 6] = RuntimeHelpers.GetObjectValue(data.Rows[num]["SoPhatSinhCo"]);
                }
                vSlist.AddItem("");
                vSlist[vSlist.Rows.Count - 1, 4] = modGeneral.Tranlated("Tổng ph\x00e1t sinh:", "");
                vSlist[vSlist.Rows.Count - 1, 5] = RuntimeHelpers.GetObjectValue(data.Rows[0]["TongSoPhatSinhNo"]);
                vSlist[vSlist.Rows.Count - 1, 6] = RuntimeHelpers.GetObjectValue(data.Rows[0]["TongSoPhatSinhCo"]);
                style = vSlist.Styles["Blue"];
                if (style == null)
                {
                    style = vSlist.Styles.Add("Blue");
                    style.BackColor = Color.Yellow;
                    style.Border.Style = C1.Win.C1FlexGrid.BorderStyleEnum.None;
                    style.Font = new Font(this.Font, FontStyle.Bold);
                }
                //vSlist.GetCellRange(vSlist.Rows.Count - 1, 0, vSlist.Rows.Count - 1, vSlist.Cols.Count - 1).Style = style;
                vSlist.AddItem("");
                vSlist[vSlist.Rows.Count - 1, 4] = modGeneral.Tranlated("Số dư cuối kỳ:", "");
                if ((num3 + num5) > (num2 + num4))
                {
                    vSlist[vSlist.Rows.Count - 1, 5] = (num3 + num5) - (num2 + num4);
                    vSlist[vSlist.Rows.Count - 1, 6] = 0;
                }
                else
                {
                    vSlist[vSlist.Rows.Count - 1, 5] = 0;
                    vSlist[vSlist.Rows.Count - 1, 6] = (num2 + num4) - (num3 + num5);
                }
                style = vSlist.Styles["Red"];
                if (style == null)
                {
                    style = vSlist.Styles.Add("Red");
                    style.BackColor = Color.DarkSeaGreen;
                    style.Border.Style = C1.Win.C1FlexGrid.BorderStyleEnum.None;
                    style.Font = new Font(this.Font, FontStyle.Bold);
                }
                //vSlist.GetCellRange(vSlist.Rows.Count - 1, 0, vSlist.Rows.Count - 1, vSlist.Cols.Count - 1).Style = style;
                vSlist = null;
            }
        }

        internal virtual ADVObjects AdvKhachHang
        {
            [DebuggerNonUserCode]
            get
            {
                return this._AdvKhachHang;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._AdvKhachHang = value;
            }
        }

        internal virtual ADVAccount AdvTaiKhoanChu
        {
            [DebuggerNonUserCode]
            get
            {
                return this._AdvTaiKhoanChu;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._AdvTaiKhoanChu = value;
            }
        }

        internal virtual Button CmdXem
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdXem;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdXem_Click);
                if (this._CmdXem != null)
                {
                    this._CmdXem.Click -= handler;
                }
                this._CmdXem = value;
                if (this._CmdXem != null)
                {
                    this._CmdXem.Click += handler;
                }
            }
        }

        internal virtual Label Label1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label1 = value;
            }
        }

        internal virtual Label Label13
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label13;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label13 = value;
            }
        }

        internal virtual Label Label16
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label16;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label16 = value;
            }
        }

        internal virtual Label Label2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label2 = value;
            }
        }

        internal virtual Panel Panel1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel1 = value;
            }
        }

        internal virtual Panel Panel2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel2 = value;
            }
        }

        internal virtual DateTimePicker TxtDenNgay
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtDenNgay;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtDenNgay = value;
            }
        }

        internal virtual DateTimePicker TxtTuNgay
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtTuNgay;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtTuNgay = value;
            }
        }

        internal virtual C1.Win.C1FlexGrid.C1FlexGrid VSlist
        {
            [DebuggerNonUserCode]
            get
            {
                return this._VSlist;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._VSlist = value;
            }
        }
    }
}

